package com.bytedance.article.common.a.a;

import android.os.Build;
import android.os.Looper;
import android.support.design.a;

import java.util.LinkedList;

final class d implements Runnable {
    private final c a;

    d(c arg1) {
        this.a = arg1;
    }

    public final void run() {
        LinkedList v1_1;
        StringBuilder v3;
        int v0 = 0;
        try {
            if (c.d()) {
                return;
            }

            if (!android.support.design.a.m("caton_monitor")) {
                return;
            }

            if (Build.VERSION.SDK_INT < 21) {
                return;
            }

            v3 = new StringBuilder();
            StackTraceElement[] v4 = Looper.getMainLooper().getThread().getStackTrace();
            int v5 = v4.length;
            int v1 = 0;
            int v2 = 0;
            while (v1 < v5) {
                ++v2;
                v3.append("\tat " + v4[v1].getClassName()).append(".").append(v4[v1].getMethodName()).append("(").append(v4[v1].getFileName()).append(":").append(v4[v1].getLineNumber()).append(")\n");
                if (v2 > 50) {
                    break;
                }

                ++v1;
            }

            v1_1 = c.e();
            synchronized (v1_1) {
                if (c.e().size() > 20) {
                    v0 = 1;
                }
                c.e().add(v3.toString());
                if (v0 == 0) {
                    return;
                }
            }
            c.a(this.a);
            return;
        } catch (Throwable v0_1) {
            v0_1.printStackTrace();
        }

    }
}

